import mockApi from "@/api/mockApi";

export default class parkingChargeApi {
  static parkingCharges = [
    {id: 1, parkingAreaId: 1, parkingAreaNumber: '010', residentRoomId: 1, residentRoomNumber: '201', licensePlate: '粤A11111', billingStartDate: '2024-01-01', billingEndDate: '2024-01-31', amount: 32.54, remark: '1月车位费', createTime: '2024-02-02 13:13:13'},
    {id: 2, parkingAreaId: 2, parkingAreaNumber: '021', residentRoomId: 2, residentRoomNumber: '302', licensePlate: '粤A11112', billingStartDate: '2024-02-01', billingEndDate: '2024-02-29', amount: 43.54, remark: '2月车位费', createTime: '2024-03-03 13:13:13'},
    {id: 3, parkingAreaId: 3, parkingAreaNumber: '032', residentRoomId: 3, residentRoomNumber: '403', licensePlate: '粤A11113', billingStartDate: '2024-03-01', billingEndDate: '2024-03-31', amount: 74.54, remark: '3月车位费', createTime: '2024-04-04 13:13:13'},
    {id: 4, parkingAreaId: 4, parkingAreaNumber: '019', residentRoomId: 4, residentRoomNumber: '503', licensePlate: '粤A11114', billingStartDate: '2024-03-01', billingEndDate: '2024-03-31', amount: 54.54, remark: '3月车位费', createTime: '2024-04-04 13:13:13'},
    {id: 5, parkingAreaId: 5, parkingAreaNumber: '043', residentRoomId: 5, residentRoomNumber: '604', licensePlate: '粤A11115', billingStartDate: '2024-04-01', billingEndDate: '2024-04-30', amount: 65.54, remark: '4月车位费', createTime: '2024-05-05 13:13:13'}
  ]

  static async save (params) {
    console.log('parkingChargeApi save params', params)
    const response = await mockApi.operateSuccessfully()
    return response.data
  }

  static async find (params) {
    console.log('parkingChargeApi find params', params)
    const response = await mockApi.queryPageSuccessfully(parkingChargeApi.parkingCharges)
    return response.data
  }

  static async findById (id) {
    console.log('parkingChargeApi findById id', id)
    let target = {}
    for (let a of parkingChargeApi.parkingCharges) {
      if (a.id === id) {
        target = a
      }
    }
    const response = await mockApi.queryByIdSuccessfully(target)
    return response.data
  }

  static async del (id) {
    console.log('parkingChargeApi del id', id)
    const response = await mockApi.operateSuccessfully()
    return response.data
  }
}